package com.qianfeng.service.impl;

import com.qianfeng.mapper.OnLineUserMapper;
import com.qianfeng.pojo.SysUserInfo;
import com.qianfeng.pojo.SysUserOnline;
import com.qianfeng.service.OnLineUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.Assert;
import org.springframework.util.ObjectUtils;

/*
 *@Description:
 *@author:刘哥
 *@Date:86180 2022/9/6 11:34
 */
@Service
public class OnLineUserServiceImpl implements OnLineUserService {
    private OnLineUserMapper onLineUserMapper;
    @Autowired
    public void setOnLineUserMapper(OnLineUserMapper onLineUserMapper) {
        this.onLineUserMapper = onLineUserMapper;
    }

    @Override
    public void addOnLineData(SysUserOnline sysUserOnline) {
        SysUserOnline userOnline =onLineUserMapper.isExist(sysUserOnline.getLoginName());
        if (ObjectUtils.isEmpty(userOnline)) {
            onLineUserMapper.addOnLineData(sysUserOnline);
        }else{
            onLineUserMapper.updateOnLineData(sysUserOnline);
        }
    }
}
